import type { Metadata } from 'next'; import Link from 'next/link'; import { ComponentGrid } from '@/components/detail/ComponentGrid'; import { ScopeHeader } from '@/components/detail/ScopeHeader'; import { ScopePressureChart } from '@/components/detail/ScopeCharts'; import { LatencyMatrixTable, LinkList, ProbesTable } from '@/components/detail/Tables'; import { IncidentsSection } from '@/components/incidents/IncidentsSection'; import { Section, Stat } from '@/components/ui/primitives'; import { apiGet, apiTry } from '@/lib/api'; import { fmt, fmtDelta, fmtInt, fmtPct } from '@/lib/format'; import type { RegionDetailResponse } from '@/lib/types'; export const dynamic = 'force-dynamic'; type Params = Promise<{ region: string }>; export async function generateMetadata({ params }: { params: Params }): Promise { const { region } = await params; const r = await apiTry(`/api/v1/pressure/region/${encodeURIComponent(region)}`); if (!r) return { title: 'Region' }; return { title: `${r.name} — Internet pressure ${fmt(r.pressure)} (${r.level_label})`, description: `Live Internet pressure for ${r.name}: ${fmt(r.pressure)} ${r.level_label}, ${fmtDelta(r.delta_1h)} over 1 h. ${r.probes.length} probes, ${r.targets} anchored targets.`, alternates: { canonical: `/internet/${region}` } }; } export default async function RegionPage({ params }: { params: Params }) { const { region } = await params; const r = await apiGet(`/api/v1/pressure/region/${encodeURIComponent(region)}`); const last24 = r.history_24h.points; const first = last24[0]?.pressure; const change24 = first != null ? r.pressure - first : null; return (
Source view from {r.probes.length} probe{r.probes.length === 1 ? '' : 's'} blended with the destination view toward {fmtInt(r.targets)} anchored targets · role {r.role} {!r.coverage_ok && · weak coverage — conclusions damped} } pressure={r.pressure} level={r.level} delta1h={r.delta_1h} trend={r.trend} confidence={r.confidence} meta={ <> Δ24h {fmtDelta(change24)} 7d median {fmt(r.baseline_7d.median)} · p90 {fmt(r.baseline_7d.p90)} centroid {r.lat}, {r.lon} } />
{r.components.routing == null &&

Routing is not attributable to this region (no ASN attribution) — shown as n/a, not zero.

}
vs 7-day baseline}>
({ key: String(a.asn), name: a.name, pressure: a.pressure, sub: `AS${a.asn}` }))} hrefFor={(k) => `/asn/${k}`} label="ASNs" />
({ key: s.slug, name: s.name, pressure: s.pressure, sub: `avail ${fmtPct(s.observed_availability_24h, 2)}` }))} hrefFor={(k) => `/service/${k}`} label="services" />
pairs from/to this region · z vs baseline}>
all incidents →}>
); }